package com.huawei.appgallery.agreementimpl.view.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import android.webkit.JavascriptInterface;
import java.util.Locale;
import o.awg;
import o.bjx.d;
import o.epw;

public class HwHiAppPrivacyJs {
    public static final int EMUI_10_0 = 21;
    private static final String TAG = "HwHiAppPrivacyJs";
    private Context mContext;

    public HwHiAppPrivacyJs(Context context) {
        this.mContext = context;
    }

    @JavascriptInterface
    public boolean needDisplay() {
        return d.ˊ >= 21;
    }

    @JavascriptInterface
    public void agreementCheckMore() {
        if (this.mContext == null) {
            awg.ˎ.ˊ(TAG, "findMorePrivacy context is null");
            return;
        }
        try {
            awg.ˎ.ˋ(TAG, "findMorePrivacy ");
            Intent intent = new Intent();
            intent.setClassName("com.huawei.systemmanager", "com.huawei.dataprivacycenter.MainActivity");
            this.mContext.startActivity(new Intent(intent));
        } catch (Exception e) {
            awg.ˎ.ˊ(TAG, "findMorePrivacy error");
        }
    }

    @JavascriptInterface
    public String getClientType() {
        Object obj = Build.BRAND;
        awg.ˎ.ˋ(TAG, "getClientType: " + obj);
        return TextUtils.isEmpty(obj) ? "" : obj.toLowerCase(Locale.ENGLISH);
    }

    @JavascriptInterface
    public String getBackgroundMode() {
        String str = epw.ˏ() ? "black" : "white";
        awg.ˎ.ˋ(TAG, "getBackgroundMode: " + str);
        return str;
    }
}
